<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="./../../header_inc.jsp"%>
<script type="text/javascript">
	//所有的子窗体都需要有一个save函数，当点击弹出窗体的保存按钮时所进行的操作

	function btnSave_click() {
			var fun_ret;
			var vals = $('#formModule').serialize();
			var url = '${saveUrl}';
			$.ajax({
				async : false,
				type : "POST",
				url : url,
				data : vals,
				cache : false,
				dataType : 'json',
				success : function(data) {
					if (data.success != 0) {
						//top.Ext.Msg.alert("提示",data.msg);
						Ext.Msg.alert("提示", data.msg);
					} else {
						fun_ret = true;
					}
				}
			});
		return fun_ret;
	}
	
	 $(document).ready(function(){
			//获取当前用户可查看到的部门
			showDataInCombotree('${ctx }/manage/sysDepartment/getAllDepaetment?flag=2',$("#depId"),'${model.sysDepartment.depId}');
		  
			 $.ajax({
				    url:"${ctx }/manage/sysRoles/getRoles",
				    type:"post",
				    dataType:"json",
				    success:function(data){
				        $('#id').combobox({ 
				            data:data.rows,
				            valueField:'id', 
				            textField:'roleName',
				            onLoadSuccess: function (data) { //加载完成后,设置选中第一项
				                var val = $(this).combobox("getData");
				              	var tid="0" + "${model.sysRoles.id}";
								var typeId = parseInt(tid);
								for (var item in val[0]) {
								if(typeId > 0)
									{
										$(this).combobox("select", typeId);
									}
								else if(item == "id")
									{
									 	$(this).combobox("select", val[0][item]);
									}
				              
								}
				            }
				        });        
				    }
				});
	 
	 
	 }); 
		

	
</script>
</head>
<body>
<!-- 只添加一些模板数据，因为客户由前台注册增加 -->
	<div style="padding: 1px" align="center">
	
		<form id="formModule" method="post">
			<table border="0">
				<tr height="0">
					<td><c:if test="${!empty model.custId }"><input type="hidden" value="${model.custId }" name="custId"></input></c:if></td>
				</tr>
				<tr height="30">
					<td>姓名：</td>
					<td><input id="userName" maxlength="10" placeholder="请输入2-4位汉字姓名"
						class="easyui-validatebox textbox" type="text"
						name="userName" data-options="required:true"
						style="width: 180px;height: 25px;text-align:center" value="${model.userName }"></input></td>
				</tr>
				<tr height="30">
					<td>所属单位：</td>
                    <td><select id="depId" name="sysDepartment.depId" class="easyui-combotree" style="width:180px;height:25px" data-options="required:true,editable:false"></select>
                    </td>
					
				</tr>
				<tr height="30">
					<td>用户角色：</td>
                    <td><select id="id" name="sysRoles.id" 
                    class="easyui-combobox" style="width: 180px;height: 25px;
                    data-options="required:true,editable:false,panelHeight:'auto'"></select>
                    </td>	
				</tr> 
				<tr height="30">
					<td>手机号码：</td>
					<td><input id="phone" maxlength="20" placeholder="请输入手机号码"
						class="easyui-validatebox textbox" type="text"
						name="phone" data-options="required:true"
						style="width: 180px;height: 25px;text-align:center" value="${model.phone }"></input></td>
				</tr>
				<tr height="30">
					<td>密码：</td>
					<td><input id="passWord" maxlength="20" placeholder="请输入密码"
						class="easyui-validatebox textbox" type="text"
						name="passWord" data-options="required:true"
						style="width: 180px;height: 25px;text-align:center" value="${model.passWord }"></input></td>
				</tr>
				<tr>
                    <td height="28">部门标识：</td>
                    <td><input type="file" class="easyui-linkbutton"
						data-options="toggle:true,group:'g2',plain:true"
						accept="image/*" id="uploadFile"
						name="uploadFile" style="width: 200px;" /></td>
                </tr>
				<tr>
					<td>状态：</td>
					<td><select id="status" name="status">
							<option value="9" <c:if test="${model.status==9 }">selected</c:if>>正常</option>
							<option value="0" <c:if test="${model.status==0 }">selected</c:if>>禁用</option>
					</select></td>
				</tr>
				
			</table>
		</form>
	</div>
</body>
</html>
